package job;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.InterruptableJob;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
/**
 * 
* @Title: CronQuartzJob.java
* @Package cn.maitian.bss.quartz.job.CronQuartzJob
* @Description: 定时任务执行类
* @author 孔庆胜   
* @date 2015-6-23 下午2:48:31
* @version V1.0
 */
public class CronQuartzJob implements Job,InterruptableJob {
	
	Log log = LogFactory.getLog("StatQuartzLogFile");
	
    private volatile Thread  thisThread;
    
    public CronQuartzJob() {
    }
    
    public void execute(JobExecutionContext context){
    	try {
			thisThread = Thread.currentThread();
			Thread.sleep(5000);
		} catch (Exception e) {
			log.error("定时任务执行错误,执行类："+this.getClass().getName(), e);
		}
    }

	/**
	 * 中断定时任务
	 * @see org.quartz.InterruptableJob#interrupt()
	 */
	
	public void interrupt(){
		if (thisThread != null) {
		  thisThread.interrupt();
		}
		
	}
}
